package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.dto.BuyTicketDTO;
import com.example.demo.dto.SearchTicketGetDTO;
import com.example.demo.service.BuyTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/buy_ticket")
public class BuyTicketController {
    @Autowired
    private BuyTicketService buyTicketService;

    @GetMapping
    public Result getTicketInfo(SearchTicketGetDTO getDTO){
        return buyTicketService.getTicketInfo(getDTO);
    }

    @PostMapping
    public Result buyTicket(@RequestBody BuyTicketDTO buyTicketDTO, @RequestHeader("Authorization")String token){
        return buyTicketService.buyTicket(buyTicketDTO, token);
    }
}
